package com.tanhua.utils;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: cfl
 * @CreateTime: 2021-06-19 17:33
 * @Description: 生成token工具
 */
public class JwtUtil {
    // 创建token
    public static String createToken(String mobile,String secret) {
        Map<String, Object> claims = new HashMap<String, Object>();
        claims.put("mobile", mobile);
        return Jwts.builder()
                .setClaims(claims) //设置响应数据体
                .signWith(SignatureAlgorithm.HS256, secret) //设置加密方法和加密盐
                .compact();
    }
}
